<template>
	<!--父级调用 FlowNodeTmp -->
	<div>
		<a-button
			v-if="status === 0"
			type="primary"
			danger
			:disabled="disabled"
		>待审核</a-button>
		<a-button
			v-else-if="status === 1"
			:disabled="disabled"
			style="color:#87d068"
		>已通过</a-button>
		<!-- {{ lastStatus }}已退回{{ status }}{{ lastStatus === status }} -->
		<template v-else-if="status === -1">
			<a-button
				type="primary"
				:style="lastStatus === status?'color:#f50':''"
				danger
				:disabled="disabled"
			>
				<span>
					已退回
				</span>
			</a-button>
			<template v-if="lastStatus !== status">
				<span style="">
					结果
				</span>
				<a-button
					type="primary"
					danger
					:disabled="disabled"
				>
					{{ getStatusTab(lastStatus) }}
				</a-button>
			</template>

		</template>
		<a-button
			v-else-if="status === 2"
			type="dashed"
			danger
			:disabled="disabled"
		>已完成</a-button>
		<!-- <a-button
			v-else
			type="link"
			:disabled="disabled"
		>等待</a-button> -->
	</div>
</template>
<script setup>
/**
 * 项目进度节点状态按钮
 */
import { ref, onMounted } from "vue";
const flowStatus = ref();
flowStatus.value = [
	{ status: -1, name: "已退回" },
	{ status: 0, name: "待审核" },
	{ status: 1, name: "已通过" },
	{ status: 2, name: "完成" },
];
const getStatusTab = (status) => {
	var data = flowStatus.value.find((e) => {
		if (e.status === status) {
			return e;
		}
	});
	if (data) {
		return data.name;
	}
	return "";
};
const props = defineProps({
	status: {
		type: Number,
		required: true,
		default: 0,
	},
	lastStatus: {
		type: Number,
		required: false,
		default: 0,
	},
	disabled: {
		type: Boolean,
		required: false,
		default: false,
	},
});
</script>